package com.ss.android.article.base.feature.feed.vh;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.support.v4.content.ContextCompat;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.UIUtils;
import com.bytedance.common.utility.collection.WeakList;
import com.ss.android.account.Spipe;
import com.ss.android.action.ArticleActionHelper;
import com.ss.android.action.b.FeedViewHolder;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.feature.app.a.ArticleConstants;
import com.ss.android.article.base.feature.app.b.DBHelper;
import com.ss.android.article.base.feature.c.FeedItemBehavior;
import com.ss.android.article.base.feature.feed.FeedOnMovedToScrapHeapListener;
import com.ss.android.article.base.feature.feed.activity.InfoLayout;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.CellRef;
import com.ss.android.article.base.feature.video.IVideoControllerContext;
import com.ss.android.article.base.ui.AdButtonLayout;
import com.ss.android.article.base.ui.DiggLayout;
import com.ss.android.article.base.ui.DrawableButton;
import com.ss.android.article.base.ui.DuplicatePressedRelativeLayout;
import com.ss.android.article.base.ui.ForeGroundImageView;
import com.ss.android.article.common.NightModeAsyncImageView;
import com.ss.android.common.ui.view.AlphaImageView;
import com.ss.android.common.util.NetworkStatusMonitor;
import com.ss.android.image.AsyncImageView;
import com.ss.android.j.ClickableBackgroundCompat;
import com.ss.android.newmedia.a.TimeFormatter;

import java.util.ArrayList;

public class BaseFeedVideoViewHolder extends FeedViewHolder implements FeedOnMovedToScrapHeapListener {
    public static final class MoreCommentsDiggInfoLayoutHolder {
        public ViewGroup mMoreCommentsDiggInfoLayout;
        public TextView mVideoTitle;
        public DiggLayout mMultiVideoDiggLayout;
        public DiggLayout mMultiVideoBuryLayout;
        public ViewGroup mCommentWrapper;
        public TextView mComment;
        public ImageView mMore;
        public View mDividerLine;
        public View mDividerSpace;
        public LinearLayout mCommentsWrapper;
        public ArrayList k = new ArrayList(0);
        static final WeakList l = new WeakList();
    }

    public TextView mAbstractCommentContent;
    public InfoLayout mInfoLayout;
    public ViewGroup mLargeImageLayout;
    public ViewGroup mRelatedVideoContainer;
    public AsyncImageView mLargeImageLayoutLargeImageIv;
    public ImageView mLargeImageLayoutLargeImageVideoPlay;
    public DrawableButton mLargeVideoTime;
    public AdButtonLayout mLargeButtonAd;
    public View mDiggInfoLayout;
    public View mNoDiggInfoLayout;
    public ViewGroup mVideoCoverLayout;
    public TextView mVideoCoverLayoutCoverTitle;
    public TextView mVideoCoverLayoutCoverSourceTv;
    public DrawableButton mVideoCoverLayoutCoverDurationBtn;
    public ImageView mVideoCoverLayoutCoverPlayIcon;
    public View mVideoCoverLayoutCoverTopShadow;
    public View mVideoCoverLayoutCoverBottomShadow;
    public AdButtonLayout mVideoCoverLayoutCoverButtonAd;
    public DiggLayout mDiggLayout;
    public DiggLayout mBuryLayout;
    public TextView mCoverActionCommentCount;
    public ImageView mCoverActionRepost;
    public TextView mVideoSourceInNoDigg;
    public TextView mVideoDurationInNoDigg;
    public TextView mVideoCommentInNoDigg;
    public ImageButton mVideoRepostInNoDigg;
    public DrawableButton mSwitchVideoCommentCount;
    public DrawableButton mSwitchVideoAction;
    public ViewGroup mVideoSwitchSoiurceInfosLayout;
    public TextView mSwitchSource;
    public TextView mCommentCount;
    public TextView mVideoDuration;
    public TextView aG;
    public AlphaImageView aH;
    public AlphaImageView aI;
    public AlphaImageView aJ;
    protected Context mContext;
    protected AppData mAppData;
    protected final Resources mResources;
    protected final NetworkStatusMonitor mNetworkMonitor;
    protected final ArticleActionHelper mArticleActionHelper;
    public final FeedItemBehavior FeedItemBehavior;
    protected IVideoControllerContext mVideoControllerContext;
    public CellRef mCellRef;
    public int aS;
    protected int aT;
    protected final int aU;
    protected final int aV;
    TimeFormatter aW;
    private boolean mIsNightMode;
    private int aY;
    private int aZ;
    MoreCommentsDiggInfoLayoutHolder mMoreCommentsDiggInfoLayoutHolder;
    public ViewGroup mEntityLayout;
    public TextView mEntityDesc;
    public View mEntityDivider;
    public TextView mEntityLike;
    public ImageView mEntityArrow;
    public ViewGroup mDiggAuthorVideoLayout;
    public ViewGroup ah;
    public ImageView mDiggAuthorVideoAuthorAvatar;
    public TextView mDiggAuthorAdAvatarTv;
    public TextView ak;
    public TextView mDiggAuthorAuthorName;
    public TextView am;
    public DiggLayout an;
    public DiggLayout ao;
    public TextView ap;
    public View aq;
    public ImageView ar;
    public View as;
    public AdButtonLayout at;
    public ViewGroup mVideoSwitchInfosStub;
    public ViewGroup mSwitchHeadNameInfos;
    public ImageView mSwichAvatar;
    public TextView mSwitchName;
    public DiggLayout mSwitchVideoDigg;
    public DiggLayout mSwitchVideoBury;
    private boolean ba;
    private ColorFilter bb;
    private Typeface mTypeface;
    private RelativeLayout mDiggAuthorVideoLayoutRootlayout;
    private ViewTreeObserver.OnPreDrawListener be;
    protected static ForegroundColorSpan o;
    public DuplicatePressedRelativeLayout mRootView;
    public ViewGroup mContentsWrapper;
    public TextView mTitle;
    public View mDelete;
    public ImageView mDivider;
    public LinearLayout mTopSourceLayout;
    public ForeGroundImageView mTopSourceIcon;
    public TextView mTopSourceIconTv;
    public TextView mTopSourceText;
    public ViewGroup mAbstractCommentLayout;
    public TextView mAbstractItem;

    public BaseFeedVideoViewHolder(Context context,
                                   NetworkStatusMonitor arg4,
                                   FeedItemBehavior feedItemBehavior,
                                   ArticleActionHelper arg6, int arg7,
                                   TimeFormatter arg8, int arg9, int arg10) {

        this.aS = -1;
        this.mIsNightMode = false;
        this.be = new ViewTreeObserver.OnPreDrawListener() {

            public final boolean onPreDraw() {
                mContentsWrapper.getViewTreeObserver().removeOnPreDrawListener(((ViewTreeObserver.OnPreDrawListener) this));
                ImageView imageView = null;
                if (mInfoLayout != null && mInfoLayout.getVisibility() == View.VISIBLE && mInfoLayout.mDislikeIcon != null && mInfoLayout.mDislikeIcon.getVisibility() == View.VISIBLE) {
                    imageView = mInfoLayout.mDislikeIcon;
                }
                if (imageView != null) {
                    int[] v1 = UIUtils.a(((View) imageView), mContentsWrapper);
                    if (v1 != null) {
                        Rect rect = new Rect();
                        int v3 = ((int) UIUtils.dp2px(mContext, 10f));
                        int v4 = ((int) UIUtils.dp2px(mContext, 5f));
                        rect.left = v1[0] - v3;
                        rect.top = v1[1] - v3;
                        rect.right = v4 + (v1[0] + ((View) imageView).getWidth());
                        rect.bottom = v1[1] + ((View) imageView).getHeight() + v3;
                        mContentsWrapper.setTouchDelegate(new TouchDelegate(rect, ((View) imageView)));
                    }
                }

                return true;
            }
        };
        this.mContext = context;
        this.FeedItemBehavior = feedItemBehavior;
        this.aT = arg7;
        this.mNetworkMonitor = arg4;
        Spipe.inst();
        this.mAppData = AppData.getInstance();
        this.mResources = this.mContext.getResources();
        this.mArticleActionHelper = arg6;
        this.aW = arg8;
        this.aV = arg9;
        this.aY = context.getResources().getDimensionPixelSize(com.ss.android.article.browser.R.dimen.hp);
        this.aZ = context.getResources().getDimensionPixelSize(com.ss.android.article.browser.R.dimen.hq);
        this.aU = arg10;
        if ((this.mContext instanceof IVideoControllerContext)) {
            this.mVideoControllerContext = (IVideoControllerContext) this.mContext;
        }
    }

    private void A() {
        if (this.mVideoSwitchSoiurceInfosLayout != null) {
            this.mVideoSwitchSoiurceInfosLayout.setBackgroundResource(com.ss.android.article.browser.R.color.switch_source_infos_bg);
            int v0 = ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinzi3);
            this.mSwitchSource.setTextColor(v0);
            this.mCommentCount.setTextColor(v0);
            this.mVideoDuration.setTextColor(v0);
        }
    }

    private void B() {
        if (this.mVideoSwitchInfosStub != null) {
            this.mVideoSwitchInfosStub.setBackgroundResource(com.ss.android.article.browser.R.color.ssxinmian4);
            this.mSwichAvatar.setColorFilter(this.bb);
            this.mSwitchName.setTextColor(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi1));
            ColorStateList v0 = ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi3);
            this.mSwitchVideoDigg.adaptNightMode(this.mIsNightMode);
            this.mSwitchVideoBury.adaptNightMode(this.mIsNightMode);
            this.mSwitchVideoCommentCount.setDrawableTop$4eb43225(ContextCompat.getDrawable(this.mContext, com.ss.android.article.browser.R.drawable.video_cover_comm_count));
            this.mSwitchVideoAction.setDrawableTop$4eb43225(ContextCompat.getDrawable(this.mContext, com.ss.android.article.browser.R.drawable.video_cover_comm_repost));
            this.mSwitchVideoCommentCount.a(v0, true);
            this.mSwitchVideoAction.a(v0, true);
        }
    }

    private void C() {
        if (this.mTopSourceLayout != null) {
            this.mTopSourceIcon.setBackgroundResource(com.ss.android.article.browser.R.drawable.circle_mian3_solid);
            this.mTopSourceIcon.setForeGroundDrawable(ContextCompat.getDrawable(this.mContext, com.ss.android.article.browser.R.drawable.circle_xian1));
            this.mTopSourceIcon.setColorFilter(this.bb);
            this.mTopSourceIconTv.setBackgroundResource(com.ss.android.article.browser.R.drawable.circle_solid_mian7);
            this.mTopSourceIconTv.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinzi7));
            this.mTopSourceText.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinzi3));
        }
    }

    public static CharSequence a(Context arg1, String arg2, int[] arg3) {
        return a(arg1, arg2, arg3, com.ss.android.article.browser.R.color.pe);
    }

    public static CharSequence a(Context arg8, String arg9, int[] arg10, int arg11) {
        SpannableString v9 = null;
        int v0 = 20;
        if (arg9 != null && arg9.length() > 0 && arg10 != null && arg10.length > 0 && arg10.length % 2 == 0) {
            int v5 = arg9.length();
            int v1 = arg10.length;
            if (v1 <= v0) {
                v0 = v1;
            }

            int v3 = 0;
            SpannableString v1_1 = new SpannableString(((CharSequence) arg9));
            int v2 = 1;
            while (v2 < v0) {
                int v6 = arg10[v2 - 1];
                int v4 = arg10[v2];
                if (v6 < v3) {
                    return arg9;
                }

                if (v6 >= v5) {
                    return arg9;
                }

                if (v4 <= v6) {
                    return arg9;
                }

                if (v4 > v5) {
                    return arg9;
                }

                v1_1.setSpan(new ForegroundColorSpan(ContextCompat.getColor(arg8, arg11)), v6, v4, 33);
                v2 += 2;
                v3 = v4;
            }

            v9 = v1_1;
        }

        return (v9);
    }

    public static void a(Context context, CellRef cellRef) {
        if (context != null && cellRef != null) {
            DBHelper dbHelper = DBHelper.getInstance(context);
            if (dbHelper != null) {
                long ts = System.currentTimeMillis();
                cellRef.appendReadTs(ts);
                if (cellRef.cellType == 0) {
                    Article article = cellRef.article;
                    if (article != null) {
                        article.clickTimestamp = ts;
                        dbHelper.syncReadTs(article);
                    }
                } else {
                    dbHelper.a(cellRef);
                }
            }
        }
    }

    public final void initView(View view) {
        this.mRootView = view.findViewById(com.ss.android.article.browser.R.id.root);
        this.mContentsWrapper = view.findViewById(com.ss.android.article.browser.R.id.contents_wrapper);
        this.mDivider = view.findViewById(com.ss.android.article.browser.R.id.divider);
        this.mTitle = view.findViewById(com.ss.android.article.browser.R.id.title);
        this.mTypeface = this.mTitle.getTypeface();
        this.mDelete = view.findViewById(com.ss.android.article.browser.R.id.delete);
        this.mInfoLayout = view.findViewById(com.ss.android.article.browser.R.id.info_layout_group);
        if (this.mAppData.getAppSettings().isVideoCellChange()) {
            UIUtils.setLayoutMargins(this.mTitle, -3, ((int) UIUtils.dp2px(this.mContext, 10f)), -3, -3);
        }
        this.mInfoLayout.setSourceIconHeight(this.aY);
        this.mInfoLayout.setSourceIconMaxWidth(this.aZ);
        this.mInfoLayout.setCommonTxtPaintTypeFace(this.mTypeface);
        this.mRootView.setOnLongClickListener(null);
    }

    protected void a(InfoLayout.Info info) {
        if (this.mCellRef.sourceIcon != null) {
            info.a |= 16;
            info.j = this.mCellRef.sourceIcon;
        } else {
            this.b(info);
        }
    }

    public final void a(CellRef cellRef, int arg5) {
        if (cellRef != null) {
            if (this.ba) {
                Logger.throwException("status dirty ! This should not occur !");
                this.onMovedToScrapHeap();
            }

            this.ba = true;
            this.mCellRef = cellRef;
            this.aS = arg5;
            if (this.mIsNightMode != AppData.isNightMode()) {
                this.mIsNightMode = AppData.isNightMode();
                if (o == null) {
                    o = new ForegroundColorSpan(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.update_comment_more_text_selector));
                }
                ColorFilter colorFilter = this.mIsNightMode ? TTUtils.getNightModeColorFilter() : null;
                this.bb = colorFilter;
                this.mTitle.setTextColor(this.mResources.getColorStateList(com.ss.android.article.browser.R.color.item_text));
                ClickableBackgroundCompat.setClickableBackground(this.mRootView, this.mIsNightMode);
                this.mDivider.setBackgroundColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.divider));
                InfoLayout.a();
                this.adaptAbstractCommentNightMode();
                this.adaptDiggInfoNightMode();
                this.v();
                this.adaptNightMode();
                this.videoCoverLayoutAdaptNightMode();
                this.f();
                this.x();
                this.adaptEntityNightMode();
                this.B();
                this.A();
                this.C();
            }

            this.g();
            int v0_1 = this.mAppData.mFontSizePref;
            if (v0_1 < 0 || v0_1 > 3) {
                v0_1 = 0;
            }

            this.mTitle.setTextSize(((float) ArticleConstants.G[v0_1]));
            if (this.mAbstractItem != null) {
                this.mAbstractItem.setTextSize(((float) ArticleConstants.I[v0_1]));
            }

            if (this.mAbstractCommentContent != null) {
                this.mAbstractCommentContent.setTextSize(((float) ArticleConstants.L[v0_1]));
            }

            this.mContentsWrapper.getViewTreeObserver().addOnPreDrawListener(this.be);
        }
    }

    protected void b(InfoLayout.Info arg4) {
        if (!this.mCellRef.f()) {
            String v0 = null;
            if (this.mCellRef.stickStyle > 0 && !android.support.design.a.isTextEmpty(this.mCellRef.stickLabel)) {
                v0 = this.mCellRef.stickLabel;
            } else if (!android.support.design.a.isTextEmpty(this.mCellRef.adLabel)) {
                v0 = this.mCellRef.adLabel;
            } else if (!android.support.design.a.isTextEmpty(this.mCellRef.label)) {
                v0 = this.mCellRef.label;
            }

            if (android.support.design.a.isTextEmpty(v0)) {
                return;
            }

            int v1 = this.mCellRef.labelStyle;
            arg4.a |= 32;
            arg4.c = v0;
            arg4.labelStyle = v1;
        }
    }

    protected final void c(InfoLayout.Info arg2) {
        int v0;
        switch (this.aT) {
            case 1:
            case 3: {
                v0 = 1;
                break;
            }
            default: {
                v0 = 0;
                break;
            }
        }

        if (v0 != 0) {
            arg2.a |= 64;
        }
    }

    private void adaptNightMode() {
        if (this.mLargeImageLayout != null) {
            ((NightModeAsyncImageView) this.mLargeImageLayoutLargeImageIv).adaptNightMode(this.mIsNightMode);
            this.mLargeImageLayoutLargeImageVideoPlay.setImageResource(com.ss.android.article.browser.R.drawable.playicon_video_selector);
            UIUtils.setBackgroundResource(this.mLargeVideoTime, com.ss.android.article.browser.R.drawable.video_time_length_bg);
            this.mLargeVideoTime.a(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi12), false);
            this.mLargeVideoTime.setDrawable(ContextCompat.getDrawable(this.mContext, com.ss.android.article.browser.R.drawable.palyicon_video_textpage), false);
            this.mLargeVideoTime.setBackgroundResource(com.ss.android.article.browser.R.drawable.video_time_length_bg);
            this.mLargeButtonAd.b(this.mIsNightMode);
        }
    }

    private void adaptDiggInfoNightMode() {
        if (this.mDiggInfoLayout != null) {
            this.mDiggInfoLayout.setBackgroundColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinmian4));
            this.mDiggLayout.adaptNightMode(this.mIsNightMode);
            this.mBuryLayout.adaptNightMode(this.mIsNightMode);
            this.mCoverActionCommentCount.setCompoundDrawablesWithIntrinsicBounds(com.ss.android.article.browser.R.drawable.video_cover_comm_count, 0, 0, 0);
            this.mCoverActionCommentCount.setTextColor(this.mContext.getResources().getColorStateList(com.ss.android.article.browser.R.color.video_comments_info));
            this.mCoverActionRepost.setImageResource(com.ss.android.article.browser.R.drawable.video_cover_comm_repost);
        }
    }

    private void f() {
        if (this.mMoreCommentsDiggInfoLayoutHolder != null) {
            MoreCommentsDiggInfoLayoutHolder moreCommentsDiggInfoLayoutHolder = this.mMoreCommentsDiggInfoLayoutHolder;
            moreCommentsDiggInfoLayoutHolder.mMoreCommentsDiggInfoLayout.setBackgroundColor(ContextCompat.getColor(mContext, com.ss.android.article.browser.R.color.ssxinmian4));
            moreCommentsDiggInfoLayoutHolder.mVideoTitle.setTextColor(ContextCompat.getColorStateList(mContext, com.ss.android.article.browser.R.color.item_text));
            moreCommentsDiggInfoLayoutHolder.mDividerLine.setBackgroundColor(ContextCompat.getColor(mContext, com.ss.android.article.browser.R.color.ssxinxian7));
            moreCommentsDiggInfoLayoutHolder.mDividerSpace.setBackgroundColor(ContextCompat.getColor(mContext, com.ss.android.article.browser.R.color.ssxinmian2));
            moreCommentsDiggInfoLayoutHolder.mMultiVideoDiggLayout.adaptNightMode(mIsNightMode);
            moreCommentsDiggInfoLayoutHolder.mMultiVideoBuryLayout.adaptNightMode(mIsNightMode);
            moreCommentsDiggInfoLayoutHolder.mComment.setCompoundDrawablesWithIntrinsicBounds(com.ss.android.article.browser.R.drawable.video_cover_comm_count, 0, 0, 0);
            moreCommentsDiggInfoLayoutHolder.mComment.setTextColor(mContext.getResources().getColorStateList(com.ss.android.article.browser.R.color.video_comments_info));
            moreCommentsDiggInfoLayoutHolder.mMore.setImageResource(com.ss.android.article.browser.R.drawable.more_video_selector);
        }
    }

    protected void g() {
        mDivider.setVisibility(mCellRef.l ? View.GONE : View.VISIBLE);
        this.mIsNightMode = AppData.isNightMode();
        ColorFilter colorFilter = this.mIsNightMode ? TTUtils.getNightModeColorFilter() : null;
        this.bb = colorFilter;
    }

    protected final boolean h() {
        boolean v0;
        switch (this.aT) {
            case 1: {
                v0 = true;
                break;
            }
            default: {
                v0 = false;
                break;
            }
        }

        return v0;
    }

    protected final boolean i() {
        boolean v0;
        switch (this.aT) {
            case 1: {
                v0 = true;
                break;
            }
            default: {
                v0 = false;
                break;
            }
        }

        return v0;
    }

    protected final boolean j() {
        boolean v0;
        switch (this.aT) {
            case 1: {
                v0 = true;
                break;
            }
            default: {
                v0 = false;
                break;
            }
        }

        return v0;
    }

    protected final void k() {
        if (this.mNoDiggInfoLayout == null) {
            this.mNoDiggInfoLayout = ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.no_digg_info_layout_stub)).inflate();
            this.mVideoSourceInNoDigg = this.mNoDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.video_source_in_no_digg);
            this.mVideoDurationInNoDigg = this.mNoDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.video_duration_in_no_digg);
            this.mVideoRepostInNoDigg = this.mNoDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.video_repost_in_no_digg);
            this.mVideoCommentInNoDigg = this.mNoDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.video_comment_in_no_digg);
            if (this.mIsNightMode) {
                this.v();
            }
        }
    }

    public void onMovedToScrapHeap() {
        this.ba = false;
        this.mContentsWrapper.getViewTreeObserver().removeOnPreDrawListener(this.be);
        this.mContentsWrapper.setTouchDelegate(null);
    }

    protected final void l() {
        int v3 = -3;
        if (this.mVideoCoverLayout == null) {
            this.mVideoCoverLayout = (ViewGroup) ((ViewStub) this.mLargeImageLayout.findViewById(com.ss.android.article.browser.R.id.video_cover_layout_stub)).inflate();
            this.mVideoCoverLayoutCoverDurationBtn = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_duration);
            this.mVideoCoverLayoutCoverDurationBtn.a();
            this.mVideoCoverLayoutCoverPlayIcon = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_play_icon);
            this.mVideoCoverLayoutCoverSourceTv = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_source);
            this.mVideoCoverLayoutCoverTitle = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_title);
            if (this.mAppData.getAppSettings().isVideoCellChange()) {
                UIUtils.setLayoutMargins(this.mVideoCoverLayoutCoverTitle, v3, ((int) UIUtils.dp2px(this.mContext, 6f)), v3, v3);
            }

            this.mVideoCoverLayoutCoverTopShadow = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_top_shaow);
            this.mVideoCoverLayoutCoverBottomShadow = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_bottom_shaow);
            this.mVideoCoverLayoutCoverButtonAd = this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.cover_button_ad);
            if (this.mIsNightMode) {
                this.videoCoverLayoutAdaptNightMode();
            }
        }
    }

    protected final void m() {
        float v3 = 20f;
        int v2 = -3;
        if (this.mDiggAuthorVideoLayout == null) {
            this.mDiggAuthorVideoLayout = (ViewGroup) ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.digg_author_video_layout_stub)).inflate();
            this.mDiggAuthorVideoLayoutRootlayout = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.root_layout);
            this.mDiggAuthorVideoAuthorAvatar = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_avatar);
            this.mDiggAuthorAdAvatarTv = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.ad_avatar_tv);
            this.mDiggAuthorAuthorName = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_name);
            this.ak = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.video_type);
            this.an = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_video_digg_layout);
            this.ah = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_avatar_wrapper);
            this.ao = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_video_bury_layout);
            this.ap = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_video_comment_count);
            this.aq = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.divider);
            this.as = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.anchor_view);
            this.ar = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_video_action);
            this.am = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.author_video_watch_count);
            this.aG = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.m8);
            this.aI = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.m7);
            this.aJ = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.m6);
            this.aH = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.m5);
            int v0 = UIUtils.percentWidth(this.mContext, 0.0625f);
            UIUtils.setLayoutMargins(this.an, v2, v2, v0, v2);
            UIUtils.setLayoutMargins(this.ao, v2, v2, v0, v2);
            ViewGroup.LayoutParams layoutParams = this.mDiggAuthorVideoLayoutRootlayout.getLayoutParams();
            if (this.mAppData.getAppSettings().isVideoCellChange()) {
                layoutParams.height = ((int) UIUtils.dp2px(this.mContext, 36f));
                layoutParams = this.mDiggAuthorVideoAuthorAvatar.getLayoutParams();
                ((FrameLayout.LayoutParams) layoutParams).height = ((int) UIUtils.dp2px(this.mContext, v3));
                ((FrameLayout.LayoutParams) layoutParams).width = ((int) UIUtils.dp2px(this.mContext, v3));
                layoutParams = this.mDiggAuthorAdAvatarTv.getLayoutParams();
                layoutParams.width = ((int) UIUtils.dp2px(this.mContext, v3));
                layoutParams.height = ((int) UIUtils.dp2px(this.mContext, v3));
            } else {
                layoutParams.height = ((int) UIUtils.dp2px(this.mContext, 40f));
            }

            if (this.mIsNightMode) {
                this.x();
            }
            this.at = this.mDiggAuthorVideoLayout.findViewById(com.ss.android.article.browser.R.id.feed_video_button_ad);
        }
    }

    protected final void n() {
        if (this.mLargeImageLayout == null) {
            this.mLargeImageLayout = (ViewGroup) ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.large_image_layout_stub)).inflate();
            this.mLargeImageLayoutLargeImageIv = this.mLargeImageLayout.findViewById(com.ss.android.article.browser.R.id.large_image);
            this.mLargeImageLayoutLargeImageVideoPlay = this.mLargeImageLayout.findViewById(com.ss.android.article.browser.R.id.large_image_video_play);
            this.mLargeVideoTime = this.mLargeImageLayout.findViewById(com.ss.android.article.browser.R.id.large_video_time);
            this.mLargeVideoTime.a();
            this.mRelatedVideoContainer = this.mLargeImageLayout.findViewById(com.ss.android.article.browser.R.id.related_video_container);
            this.mLargeButtonAd = this.mLargeImageLayout.findViewById(com.ss.android.article.browser.R.id.large_button_ad);
            if (this.mIsNightMode) {
                this.adaptNightMode();
            }
        }
    }

    protected final void o() {
        if (this.mMoreCommentsDiggInfoLayoutHolder == null) {
            View moreCommentsDiggInfoLayoutStub = this.mRootView.findViewById(com.ss.android.article.browser.R.id.more_comments_digg_info_layout_stub);
            this.mMoreCommentsDiggInfoLayoutHolder = new MoreCommentsDiggInfoLayoutHolder();
            MoreCommentsDiggInfoLayoutHolder moreCommentsDiggInfoLayoutHolder = this.mMoreCommentsDiggInfoLayoutHolder;
            View moreCommentsDiggInfoLayout = ((ViewStub) moreCommentsDiggInfoLayoutStub).inflate();
            moreCommentsDiggInfoLayoutHolder.mMoreCommentsDiggInfoLayout = (ViewGroup) moreCommentsDiggInfoLayout;
            moreCommentsDiggInfoLayoutHolder.mVideoTitle = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.video_title);
            moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.actions);
            moreCommentsDiggInfoLayoutHolder.mMultiVideoDiggLayout = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.multi_video_digg_layout);
            moreCommentsDiggInfoLayoutHolder.mMultiVideoBuryLayout = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.multi_video_bury_layout);
            int diggLayoutWidth = UIUtils.diggLayoutWidth(moreCommentsDiggInfoLayout.getContext());
            moreCommentsDiggInfoLayoutHolder.mMultiVideoDiggLayout.getLayoutParams().width = diggLayoutWidth;
            moreCommentsDiggInfoLayoutHolder.mMultiVideoBuryLayout.getLayoutParams().width = diggLayoutWidth;
            moreCommentsDiggInfoLayoutHolder.mCommentWrapper = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.comment_wrapper);
            moreCommentsDiggInfoLayoutHolder.mComment = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.comment);
            moreCommentsDiggInfoLayoutHolder.mMore = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.more);
            moreCommentsDiggInfoLayoutHolder.mDividerLine = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.divider_line);
            moreCommentsDiggInfoLayoutHolder.mDividerSpace = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.divider_space);
            moreCommentsDiggInfoLayoutHolder.mCommentsWrapper = moreCommentsDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.comments_wrapper);
            if (this.mIsNightMode) {
                this.f();
            }
        }
    }

    protected final void initDiggInfoLayout() {
        if (this.mDiggInfoLayout == null) {
            this.mDiggInfoLayout = ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.digg_info_layout_stub)).inflate();
            this.mDiggLayout = this.mDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.digg_layout);
            this.mBuryLayout = this.mDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.bury_layout);
            int diggLayoutWidth = UIUtils.diggLayoutWidth(this.mRootView.getContext());
            this.mDiggLayout.getLayoutParams().width = diggLayoutWidth;
            this.mBuryLayout.getLayoutParams().width = diggLayoutWidth;
            this.mCoverActionCommentCount = this.mDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.cover_action_comment_count);
            this.mCoverActionRepost = this.mDiggInfoLayout.findViewById(com.ss.android.article.browser.R.id.cover_action_repost);
            if (this.mIsNightMode) {
                this.adaptDiggInfoNightMode();
            }
        }
    }

    protected final void initAbstractCommentLayout() {
        if (this.mAbstractCommentLayout == null) {
            this.mAbstractCommentLayout = (ViewGroup) ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.abstract_comment_stub)).inflate();
            this.mAbstractItem = this.mAbstractCommentLayout.findViewById(com.ss.android.article.browser.R.id.item_abstract);
            this.mAbstractCommentContent = this.mAbstractCommentLayout.findViewById(com.ss.android.article.browser.R.id.comment_content);
            this.mRootView.addAffectView(this.mAbstractCommentContent);
            if (this.mIsNightMode) {
                this.adaptAbstractCommentNightMode();
            }
        }
    }

    protected final void initEntityLayout() {
        if (this.mEntityLayout == null) {
            this.mEntityLayout = (ViewGroup) ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.entity_layout_stub)).inflate();
            this.mEntityDesc = this.mEntityLayout.findViewById(com.ss.android.article.browser.R.id.desc);
            this.mEntityDivider = this.mEntityLayout.findViewById(com.ss.android.article.browser.R.id.divider);
            this.mEntityLike = this.mEntityLayout.findViewById(com.ss.android.article.browser.R.id.like);
            this.mEntityArrow = this.mEntityLayout.findViewById(com.ss.android.article.browser.R.id.arrow);
            if (this.mIsNightMode) {
                this.adaptEntityNightMode();
            }
        }
    }

    protected final void initVideoSwitchInfosLayout() {
        if (this.mVideoSwitchInfosStub == null) {
            this.mVideoSwitchInfosStub = (ViewGroup) ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.video_switch_infos_stub)).inflate();
            this.mSwitchHeadNameInfos = this.mVideoSwitchInfosStub.findViewById(com.ss.android.article.browser.R.id.head_name_infos);
            this.mSwichAvatar = this.mSwitchHeadNameInfos.findViewById(com.ss.android.article.browser.R.id.switch_avatar);
            this.mSwitchName = this.mSwitchHeadNameInfos.findViewById(com.ss.android.article.browser.R.id.switch_name);
            this.mSwitchVideoDigg = this.mVideoSwitchInfosStub.findViewById(com.ss.android.article.browser.R.id.switch_video_digg);
            this.mSwitchVideoBury = this.mVideoSwitchInfosStub.findViewById(com.ss.android.article.browser.R.id.switch_video_bury);
            this.mSwitchVideoCommentCount = this.mVideoSwitchInfosStub.findViewById(com.ss.android.article.browser.R.id.switch_video_comment_count);
            this.mSwitchVideoAction = this.mVideoSwitchInfosStub.findViewById(com.ss.android.article.browser.R.id.switch_video_action);
            int padding = UIUtils.percentWidth(this.mContext, 0.0427f);
            int dp15 = ((int) UIUtils.dp2px(this.mContext, 15f));
            this.mSwitchVideoDigg.setPadding(dp15, 0, padding, 0);
            this.mSwitchVideoBury.setPadding(padding, 0, padding, 0);
            this.mSwitchVideoCommentCount.setPadding(padding, 0, padding, 0);
            this.mSwitchVideoAction.setPadding(padding, 0, dp15, 0);
            if (this.mIsNightMode) {
                this.B();
            }
        }
    }

    protected final void t() {
        if (this.mVideoSwitchSoiurceInfosLayout == null) {
            this.mVideoSwitchSoiurceInfosLayout = (ViewGroup) ((ViewStub) this.mVideoCoverLayout.findViewById(com.ss.android.article.browser.R.id.video_switch_source_infos_stub)).inflate();
            this.mSwitchSource = this.mVideoSwitchSoiurceInfosLayout.findViewById(com.ss.android.article.browser.R.id.switch_source);
            this.mCommentCount = this.mVideoSwitchSoiurceInfosLayout.findViewById(com.ss.android.article.browser.R.id.comment_count);
            this.mVideoDuration = this.mVideoSwitchSoiurceInfosLayout.findViewById(com.ss.android.article.browser.R.id.video_duration);
            if (this.mIsNightMode) {
                this.A();
            }
        }
    }

    protected final void u() {
        int v3 = -3;
        if (this.mTopSourceLayout == null) {
            this.mTopSourceLayout = (LinearLayout) ((ViewStub) this.mRootView.findViewById(com.ss.android.article.browser.R.id.top_source_layout_stub)).inflate();
            if (this.mAppData.getAppSettings().isVideoCellChange()) {
                UIUtils.setLayoutMargins(this.mTopSourceLayout, v3, ((int) UIUtils.dp2px(this.mContext, 10f)), v3, v3);
            }

            this.mTopSourceIcon = this.mTopSourceLayout.findViewById(com.ss.android.article.browser.R.id.top_source_icon);
            this.mTopSourceIconTv = this.mTopSourceLayout.findViewById(com.ss.android.article.browser.R.id.top_source_icon_tv);
            this.mTopSourceIconTv.getPaint().setFakeBoldText(true);
            this.mTopSourceText = this.mTopSourceLayout.findViewById(com.ss.android.article.browser.R.id.top_source_text);
            if (!this.mIsNightMode) {
                return;
            }

            this.C();
        }
    }

    private void v() {
        if (this.mNoDiggInfoLayout != null) {
            Resources resources = this.mContext.getResources();
            this.mNoDiggInfoLayout.setBackgroundColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinmian4));
            this.mVideoCommentInNoDigg.setCompoundDrawablesWithIntrinsicBounds(com.ss.android.article.browser.R.drawable.video_cover_comm_count, 0, 0, 0);
            this.mVideoRepostInNoDigg.setImageResource(com.ss.android.article.browser.R.drawable.video_cover_comm_repost);
            this.mVideoSourceInNoDigg.setTextColor(resources.getColorStateList(com.ss.android.article.browser.R.color.video_comments_info));
            this.mVideoDurationInNoDigg.setTextColor(resources.getColorStateList(com.ss.android.article.browser.R.color.video_comments_info));
            this.mVideoCommentInNoDigg.setTextColor(resources.getColorStateList(com.ss.android.article.browser.R.color.video_comments_info));
        }
    }

    private void adaptAbstractCommentNightMode() {
        if (this.mAbstractCommentLayout != null) {
            this.mAbstractItem.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinzi3));
            this.mAbstractCommentContent.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinzi2));
            this.mAbstractCommentContent.setBackgroundResource(com.ss.android.article.browser.R.drawable.cq);
        }
    }

    private void x() {
        if (this.mDiggAuthorVideoLayout != null) {
            this.mDiggAuthorVideoAuthorAvatar.setColorFilter(this.bb);
            this.mDiggAuthorAdAvatarTv.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.ssxinzi7));
            this.mDiggAuthorAdAvatarTv.setBackgroundResource(com.ss.android.article.browser.R.drawable.circle_solid_mian7);
            this.an.adaptNightMode(this.mIsNightMode);
            this.ao.adaptNightMode(this.mIsNightMode);
            this.ap.setTextColor(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.video_comments_info));
            this.ap.setCompoundDrawablesWithIntrinsicBounds(com.ss.android.article.browser.R.drawable.video_cover_comm_count, 0, 0, 0);
            this.aq.setBackgroundResource(com.ss.android.article.browser.R.color.ssxinxian1);
            this.am.setTextColor(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi3));
        }
    }

    private void videoCoverLayoutAdaptNightMode() {
        if (this.mVideoCoverLayout != null) {
            this.mVideoCoverLayoutCoverTitle.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.article_video_cover_txt_color));
            this.mVideoCoverLayoutCoverSourceTv.setTextColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.article_video_cover_txt_color));
            this.mVideoCoverLayoutCoverDurationBtn.a(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi12), false);
            this.mVideoCoverLayoutCoverDurationBtn.setBackgroundResource(com.ss.android.article.browser.R.drawable.video_time_length_bg);
            this.mVideoCoverLayoutCoverPlayIcon.setImageResource(com.ss.android.article.browser.R.drawable.playicon_video_selector);
            this.mVideoCoverLayoutCoverTopShadow.setBackgroundResource(com.ss.android.article.browser.R.drawable.thr_shadow_video);
            this.mVideoCoverLayoutCoverBottomShadow.setBackgroundResource(com.ss.android.article.browser.R.drawable.two_shadow_video);
            this.mVideoCoverLayout.setBackgroundColor(ContextCompat.getColor(this.mContext, com.ss.android.article.browser.R.color.video_cover_layout_background));
            this.mVideoCoverLayoutCoverButtonAd.b(this.mIsNightMode);
        }
    }

    private void adaptEntityNightMode() {
        if (this.mEntityLayout != null) {
            this.mEntityLayout.setBackgroundResource(com.ss.android.article.browser.R.drawable.rect_mian3xian1_selector);
            this.mEntityDesc.setTextColor(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi2_selector));
            this.mEntityDivider.setBackgroundResource(com.ss.android.article.browser.R.color.ssxinxian10);
            this.mEntityLike.setTextColor(ContextCompat.getColorStateList(this.mContext, com.ss.android.article.browser.R.color.ssxinzi3_selector));
            this.mEntityLike.setCompoundDrawablesWithIntrinsicBounds(com.ss.android.article.browser.R.drawable.gl, 0, 0, 0);
            this.mEntityArrow.setImageResource(com.ss.android.article.browser.R.drawable.like_arrow_textpage_selector);
        }
    }
}

